﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DevExpress.XtraGrid.Views.Grid;

namespace LPV_POS.thuvien_cls
{
    public class dinhdangcontrol
    {
        #region "cac ham bo sung"
        private void p_Grid_CustomDrawRowIndicator(object sender, RowIndicatorCustomDrawEventArgs e)
        {
            //Check whether the indicator cell belongs to a data row
            if (e.Info.IsRowIndicator && e.RowHandle >= 0)
            {
                int stt = 1 + e.RowHandle;
                e.Info.DisplayText = stt.ToString();
            }
        }
        #endregion
        
        #region "GridControl"

        public void f_gridcontrol(GridView p_Grid, Boolean p_GroupPanel, Boolean p_STT)
        {
            p_Grid = new GridView();
            p_Grid.Appearance.Row.Font = new System.Drawing.Font("Times New Roman", 16F);
            p_Grid.Appearance.Row.Options.UseFont = true;
            p_Grid.Appearance.HeaderPanel.Font = new System.Drawing.Font("Times New Roman", 16F);
            p_Grid.Appearance.HeaderPanel.Options.UseFont = true;
            p_Grid.Appearance.GroupPanel.Font = new System.Drawing.Font("Times New Roman", 14F);
            p_Grid.Appearance.GroupPanel.Options.UseFont = true;

            if (p_GroupPanel == true)
                p_Grid.OptionsView.ShowGroupPanel = true;
            else
                p_Grid.OptionsView.ShowGroupPanel = false;

            if (p_STT == true)
            {
                p_Grid.OptionsView.ShowIndicator = true;
                p_Grid.IndicatorWidth = 40;
                // so thu tu

                p_Grid.CustomDrawRowIndicator += new RowIndicatorCustomDrawEventHandler(p_Grid_CustomDrawRowIndicator);
            }
            else
                p_Grid.OptionsView.ShowIndicator = false;

            p_Grid.OptionsSelection.EnableAppearanceFocusedCell = false;
            p_Grid.OptionsSelection.EnableAppearanceFocusedRow = false;

        }

        #endregion
           
    }
}
